package com.dhj.lambdaTest;

public class Demo4 {

    public static void main(String[] args) {

        functionOne(5, num -> num % 2 == 0);

        functionTwo(15, num -> num % 5 == 0);
    }


    public static void functionOne(int num, ParityCheck function) {
        if (function.check(num)) {
            System.out.println("=== " + num + "是偶数");
        } else {
            System.out.println("=== " + num + "是奇数");
        }
    }


    public static void functionTwo(int num, ParityCheck function) {
        if (function.check(num)) {
            System.out.println("=== " + num + "是5的倍数");
        } else {
            System.out.println("=== " + num + "不是5的倍数");
        }
    }

}

interface ParityCheck {
    boolean check(int num);
}
